let url = new URL("http://192.168.0.108:8888/wmp/v3.1/?p0=117&p1=searchNewsKeywordsList&pagesize=10&order=sIdxTime&r0=cors&r1=NewsObj&type=iTag&source=web_m&page=1&id=6521");
let pro = getAjax(url);

pro.then(result => {
    let obj = JSON.parse(result);
    let resultList = obj.msg.result;
    console.log(resultList);
    let str = "";
    let showbox = document.getElementsByClassName("showbox")[0];
    for (let i = 0; i < resultList.length; i++) {
        str += `
            <div class="show">
                <div class="showimg">
                    <img src="${resultList[i].sIMG}" alt="">
                </div>
                <p class="showtype">团队博客·人才招聘</p>
                <h2 class="showh2">${resultList[i].sTitle}</h2>
                <div class="showbottom">
                    <img src="../imgs/眼睛.png" alt="">
                    <span class="liulan">${resultList[i].iTotalPlay}</span>
                    <img src="../imgs/点赞.png" alt="">
                    <span class="dianzan">25</span>
                    <span class="zuozhe">xxxx</span>
                    <span class="time">${resultList[i].sIdxTime}</span>
                </div>
            </div>
        
        `
    }
    showbox.innerHTML = str;


}).catch(err => {
    console.log(err);

})


let header = document.getElementsByClassName("header")[0];


// window.onscroll = function () {
//     // 检查页面是否已经滚动
//     if (window.pageYOffset > 0) {
//         // 如果页面向下滚动，显示导航栏
//         header.style.top = '-125px';
//     } else {
//         // 如果页面向上滚动，隐藏导航栏
//         header.style.top = '0px';
//     }
// }
// 定义一个函数来处理滚动事件
function handleScroll(event) {

    // 检查滚动方向
    if (event.deltaY < 0) {
        // 向上滑动页面
        header.style.transform = 'translateY(0px)';
    } else if (event.deltaY > 0) {
        // 向下滑动页面
        header.style.transform = 'translateY(-125px)';
    }
}

// 添加事件监听器到整个文档
document.addEventListener('wheel', handleScroll);


